package com.life.mapper;

import com.life.annotation.AutoFill;
import com.life.enumeration.OperationType;
import com.life.pojo.dto.TagDTO;
import com.life.pojo.entity.Tag;
import com.life.pojo.vo.ArticleVO;
import com.life.pojo.vo.TagVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TagMapper {

    @Select("select * from tag order by is_top desc,update_time desc")
    List<TagVO> getTagList();

    @Insert("insert into tag (name,create_time,update_time) values (#{name},#{createTime},#{updateTime})")
    @AutoFill(OperationType.INSERT)
    void insertTag(Tag tag);

    @AutoFill(OperationType.UPDATE)
    void updateTag(Tag tag);

    @Delete("delete from tag where id = #{id}")
    void deleteTag(Long id);
}
